extends Node2D
class_name Boss01

@onready var hpProgressBar = $HP/TextureProgressBar
@onready var stateMachine:StateMachine = $StateMachine
@export var maxHp = 1000
var hp 


func _physics_process(delta):
	stateMachine.run(delta, self)
	
	
func _ready():
	stateMachine.addState("Arranger", self)
	
	hp = maxHp
	updateHPUI()


func onHit(damage):
	hp -= damage
	updateHPUI()
	
	if hp <= 0:
		queue_free()
		Global.signalGameEnd.emit(true)
	

func updateHPUI():
	hpProgressBar.value = hp * 1.0 / maxHp

